<template>
  <div class="searchList">
      <div class="cellItem" v-for="(searchKeyword,index) in liveSearchList" :key="index" @click="showResultList(searchKeyword)">
          <span>{{searchKeyword}}</span>
          <van-icon name="arrow" />
      </div>
  </div>
</template>

<script>
import {saveTags} from '@/utils/search'
export default {
    name: 'searchList',
    props: ['liveSearchList'],
    data(){return {}},
    methods: {
        // 点击tag显示搜索详情页面
        showResultList(searchKeyword){
            // 存储到本地
            saveTags(searchKeyword)
            this.$emit('initSearchResult',searchKeyword)
        },
    },
}
</script>

<style lang='less' scoped>
.searchList{
    .cellItem{
        display: flex;
        justify-content: space-between;
        font-size: 14px;
        color: #333;
        margin-left: 15px;
        padding: 18px 15px 10px 0;
        &~div {
            border-top: 1px solid #ccc;
        }
    }
}
</style>